package org.alanlau.zuul.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;

/**
 * 测试异常捕获过滤器
 *
 * @author liukun
 * @version 1.0
 * @date 2020/9/23 19:38
 */
public class TestErrorFilter extends ZuulFilter {
    @Override
    public String filterType() {
        return "pre";
    }

    @Override
    public int filterOrder() {
        return 1;
    }

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() throws ZuulException {
        // 模拟测试抛出异常
        System.out.println(1 / 0);
        return null;
    }
}
